package com.jiang.smartdangjian.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.jiang.smartdangjian.R;
import com.jiang.smartdangjian.tool.MyAdapter;

import java.util.Arrays;

public class S1D1Activity extends BaseActivity {

    private RecyclerView rv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_s1_d1);
        initView();
        setTitle("章节");
    }

    private void initView() {
        rv = (RecyclerView) findViewById(R.id.rv);
        rv.setLayoutManager(new LinearLayoutManager(getThis()));

        rv.setAdapter(new MyAdapter<String>(getThis(), R.layout.item_zhangjie, Arrays.asList("", "", "", "")) {
            private TextView textView17;
            private TextView textView18;

            @Override
            public void init(View root, int position) {
                textView17 = (TextView) root.findViewById(R.id.textView17);
                textView18 = (TextView) root.findViewById(R.id.textView18);
                int p = position + 1;
                textView17.setText("" + p + "、共产党章程");
                textView18.setText("" + p + ".1党章的概念\n\n"
                        + p + ".2党章的功能和定位\n\n"
                        + p + ".3党章的基本结构");

                root.setOnClickListener(v -> {
                    startActivity(new Intent(getThis(), S1D2Activity.class));
                });
            }
        });
    }
}